1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gobject.BindingGroup; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.Closure; 30 private import gobject.ObjectG; 31 private import gobject.c.functions; 32 public import gobject.c.types; 33 34 35 /** 36 * The #GBindingGroup can be used to bind multiple properties 37 * from an object collectively. 38 * 39 * Use the various methods to bind properties from a single source 40 * object to multiple destination objects. Properties can be bound 41 * bidirectionally and are connected when the source object is set 42 * with g_binding_group_set_source(). 43 * 44 * Since: 2.72 45 */ 46 public class BindingGroup : ObjectG 47 { 48 /** the main Gtk struct */ 49 protected GBindingGroup* gBindingGroup; 50 51 /** Get the main Gtk struct */ 52 public GBindingGroup* getBindingGroupStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return gBindingGroup; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected override void* getStruct() 61 { 62 return cast(void*)gBindingGroup; 63 } 64 65 /** 66 * Sets our main struct and passes it to the parent class. 67 */ 68 public this (GBindingGroup* gBindingGroup, bool ownedRef = false) 69 { 70 this.gBindingGroup = gBindingGroup; 71 super(cast(GObject*)gBindingGroup, ownedRef); 72 } 73 74 75 /** */ 76 public static GType getType() 77 { 78 return g_binding_group_get_type(); 79 } 80 81 /** 82 * Creates a new #GBindingGroup. 83 * 84 * Returns: a new #GBindingGroup 85 * 86 * Since: 2.72 87 * 88 * Throws: ConstructionException GTK+ fails to create the object. 89 */ 90 public this() 91 { 92 auto __p = g_binding_group_new(); 93 94 if(__p is null) 95 { 96 throw new ConstructionException("null returned by new"); 97 } 98 99 this(cast(GBindingGroup*) __p, true); 100 } 101 102 /** 103 * Creates a binding between @source_property on the source object 104 * and @target_property on @target. Whenever the @source_property 105 * is changed the @target_property is updated using the same value. 106 * The binding flag %G_BINDING_SYNC_CREATE is automatically specified. 107 * 108 * See g_object_bind_property() for more information. 109 * 110 * Params: 111 * sourceProperty = the property on the source to bind 112 * target = the target #GObject 113 * targetProperty = the property on @target to bind 114 * flags = the flags used to create the #GBinding 115 * 116 * Since: 2.72 117 */ 118 public void bind(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags) 119 { 120 g_binding_group_bind(gBindingGroup, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags); 121 } 122 123 /** 124 * Creates a binding between @source_property on the source object and 125 * @target_property on @target, allowing you to set the transformation 126 * functions to be used by the binding. The binding flag 127 * %G_BINDING_SYNC_CREATE is automatically specified. 128 * 129 * See g_object_bind_property_full() for more information. 130 * 131 * Params: 132 * sourceProperty = the property on the source to bind 133 * target = the target #GObject 134 * targetProperty = the property on @target to bind 135 * flags = the flags used to create the #GBinding 136 * transformTo = the transformation function 137 * from the source object to the @target, or %NULL to use the default 138 * transformFrom = the transformation function 139 * from the @target to the source object, or %NULL to use the default 140 * userData = custom data to be passed to the transformation 141 * functions, or %NULL 142 * userDataDestroy = function to be called when disposing the binding, 143 * to free the resources used by the transformation functions 144 * 145 * Since: 2.72 146 */ 147 public void bindFull(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags, GBindingTransformFunc transformTo, GBindingTransformFunc transformFrom, void* userData, GDestroyNotify userDataDestroy) 148 { 149 g_binding_group_bind_full(gBindingGroup, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags, transformTo, transformFrom, userData, userDataDestroy); 150 } 151 152 /** 153 * Creates a binding between @source_property on the source object and 154 * @target_property on @target, allowing you to set the transformation 155 * functions to be used by the binding. The binding flag 156 * %G_BINDING_SYNC_CREATE is automatically specified. 157 * 158 * This function is the language bindings friendly version of 159 * g_binding_group_bind_property_full(), using #GClosures 160 * instead of function pointers. 161 * 162 * See g_object_bind_property_with_closures() for more information. 163 * 164 * Params: 165 * sourceProperty = the property on the source to bind 166 * target = the target #GObject 167 * targetProperty = the property on @target to bind 168 * flags = the flags used to create the #GBinding 169 * transformTo = a #GClosure wrapping the 170 * transformation function from the source object to the @target, 171 * or %NULL to use the default 172 * transformFrom = a #GClosure wrapping the 173 * transformation function from the @target to the source object, 174 * or %NULL to use the default 175 * 176 * Since: 2.72 177 */ 178 public void bindWithClosures(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags, Closure transformTo, Closure transformFrom) 179 { 180 g_binding_group_bind_with_closures(gBindingGroup, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags, (transformTo is null) ? null : transformTo.getClosureStruct(), (transformFrom is null) ? null : transformFrom.getClosureStruct()); 181 } 182 183 /** 184 * Gets the source object used for binding properties. 185 * 186 * Returns: a #GObject or %NULL. 187 * 188 * Since: 2.72 189 */ 190 public ObjectG dupSource() 191 { 192 auto __p = g_binding_group_dup_source(gBindingGroup); 193 194 if(__p is null) 195 { 196 return null; 197 } 198 199 return ObjectG.getDObject!(ObjectG)(cast(GObject*) __p); 200 } 201 202 /** 203 * Sets @source as the source object used for creating property 204 * bindings. If there is already a source object all bindings from it 205 * will be removed. 206 * 207 * Note that all properties that have been bound must exist on @source. 208 * 209 * Params: 210 * source = the source #GObject, 211 * or %NULL to clear it 212 * 213 * Since: 2.72 214 */ 215 public void setSource(ObjectG source) 216 { 217 g_binding_group_set_source(gBindingGroup, (source is null) ? null : source.getObjectGStruct()); 218 } 219 }